package com.grade.system.mapper;

import com.grade.system.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface UserMapper {

    @Select("select * from user where name=#{name} and pwd=#{pwd}")
    User selUserByNameAndPwd(@Param("name") String name, @Param("pwd") String pwd);

    @Select("select * from user where name=#{name}")
    User selUserByName(@Param("name") String name);

    @Select("select * from user")
    List<User> selUserByAll();

    @Select("select * from user where id=#{id}")
    User selUserById(@Param("id") int id);

    @Insert("insert user(name,pwd,status) values(#{name},#{pwd},#{status})")
    boolean insUser(User user);

    @Update("update user set name=#{name},pwd=#{pwd},status=#{status} where id=#{id}")
    boolean updUserById(User user);

    @Delete("delete from user where id = #{id}")
    boolean delUserById(int id);
}
